UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M/smNcwaZbWYrs6tpUJijqgTs7AEsNFjq92P+54eUds=' 
WHERE 
  key_id = 'a2e52792ed7ef29602461e090e7346b04addba258748bfdc18bc872772cbc0b3' 
  AND (
    token = 'M/smNcwaZbWYrs6tpUJijqgTs7AEsNFjq92P+54eUds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048