UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '62ButEQuLTef9APBqa8iAHwnHuPouzMYXvs1CgXZYUU=' 
WHERE 
  key_id = 'd9941ef3f56d78a740f00dc660899abac5561b398bb068cb64deec9639159077' 
  AND (
    token = '62ButEQuLTef9APBqa8iAHwnHuPouzMYXvs1CgXZYUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036