UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7lZaQs/KmtLJn1CZwXdJcNBw0XZkBIimE14QT28whUs=' 
WHERE 
  key_id = '405e2ea6980916cd70b93d93b9e4f536a4442dccb73a4829fa12c09038c95f4e' 
  AND (
    token = '7lZaQs/KmtLJn1CZwXdJcNBw0XZkBIimE14QT28whUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033