UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZPnF0UKFUUinB65Cx6AX+uvYUbkhkBfPUIOUK1varXk=' 
WHERE 
  key_id = '2786f92c7046f704b2592eed1897f82c81063f9b33ac61bec4ba12454749eaea' 
  AND (
    token = 'ZPnF0UKFUUinB65Cx6AX+uvYUbkhkBfPUIOUK1varXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043