UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'crbK65m4/PJdgtZbCqz+syRMp/4R2cMferhffPFIlZs=' 
WHERE 
  key_id = 'ddc5571dc50c6fac381430335146603bad947b7d7010ba8a20a3aa6987b4efdc' 
  AND (
    token = 'crbK65m4/PJdgtZbCqz+syRMp/4R2cMferhffPFIlZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033