UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HrOyrEyJHNp7rEtwmo3AAm1OClOyvwi0Zy4kFBRTRYs=' 
WHERE 
  key_id = '2c91673a7b00f38228427b966d5a337b727f3542097716a6f61b162ecd94714e' 
  AND (
    token = 'HrOyrEyJHNp7rEtwmo3AAm1OClOyvwi0Zy4kFBRTRYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032