UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r9KTgTi9W1AXl2QRE7JB30T0QcTckc8G2l01CU+O52s=' 
WHERE 
  key_id = 'ef22a875b57c756825521d5d10b8bc3f067a122ca4f10d080a1c8e584a5db635' 
  AND (
    token = 'r9KTgTi9W1AXl2QRE7JB30T0QcTckc8G2l01CU+O52s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040