UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KW/Zs3yOYpJNo3Q7CCRFAu3XDveVjcs3+/j44kDo3C4=' 
WHERE 
  key_id = '1d7f494a41568ddedde7e5261d0b637af1cca90249523bc05076987a3d380584' 
  AND (
    token = 'KW/Zs3yOYpJNo3Q7CCRFAu3XDveVjcs3+/j44kDo3C4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034