UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RP27itoFgNcYrzldxKQ6LDneogn11DxkreP+zXwI43E=' 
WHERE 
  key_id = '159e0748815d1a2e7cefb981409d792d85566298eaf6d353495ab2b7c1d86c01' 
  AND (
    token = 'RP27itoFgNcYrzldxKQ6LDneogn11DxkreP+zXwI43E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034