UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a4L2ZkM92ih7qOCaZEsz7V2lufllHg2hOJ8bbxeY2I8=' 
WHERE 
  key_id = 'a4f1cb44cd4b731902e595beddab3234440213bcc904467cb4681a77d27efc45' 
  AND (
    token = 'a4L2ZkM92ih7qOCaZEsz7V2lufllHg2hOJ8bbxeY2I8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040