UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F+aMFy2SNXco4ipc63xgYk2Qft+VZF89zHSGwNkbpHE=' 
WHERE 
  key_id = 'f44e7f1efa768d9c8c78a7398c4bedeb266c77ec354cd31e3aaa205df5b3b2d3' 
  AND (
    token = 'F+aMFy2SNXco4ipc63xgYk2Qft+VZF89zHSGwNkbpHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039