UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GshfrGGoJUhuzDK1znFLLbr4rI1Fctv2g+XHagjuP6k=' 
WHERE 
  key_id = '9a8ad81515a9b5c3a7b4475fdb5d1e26b4fdf255f6fa61d7c6c1750eb6387096' 
  AND (
    token = 'GshfrGGoJUhuzDK1znFLLbr4rI1Fctv2g+XHagjuP6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024