UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G82nc5OKAOFV/u4gmy1frnss/ywuxiZGE80qK88XU2E=' 
WHERE 
  key_id = '4559bee50cdabca3d045d585c09764ec46f002f74003720c9fe23ce19b8e3939' 
  AND (
    token = 'G82nc5OKAOFV/u4gmy1frnss/ywuxiZGE80qK88XU2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024